// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
export const switchStatus = [
  { label: '开启', value: 1 },
  { label: '关闭', value: 0 }
]

export const fromList = {
  title: '选择时间',
  custom: true,
  fromTxt: [
    { text: '全部', val: '' },
    { text: '今天', val: 'today' },
    { text: '昨天', val: 'yesterday' },
    { text: '最近7天', val: 'lately7' },
    { text: '最近30天', val: 'lately30' },
    { text: '本月', val: 'month' },
    { text: '本年', val: 'year' }
  ]
}

export const pickerOptions = {
          shortcuts: [{
            text: '今天',
            onClick(picker) {
            const end = new Date();
            const start = new Date(new Date().setHours(0, 0, 0, 0));
            picker.$emit('pick', [start, end]);
            }
          }, {
            text: '昨天',
              onClick(picker) {
              const yesterday = new Date();
              yesterday.setDate(yesterday.getDate() - 1);
              const start = new Date(yesterday);
              start.setHours(0, 0, 0, 0);
              const end = new Date(yesterday);
              end.setHours(23, 59, 59, 999);
              picker.$emit('pick', [start, end]);
            }
          }, {
              text: '最近7天',
              onClick(picker) {
              const yesterday = new Date();
              yesterday.setDate(yesterday.getDate() - 7);
              const start = new Date(yesterday);
              start.setHours(0, 0, 0, 0);
              const end = new Date();
              end.setHours(23, 59, 59, 999);
              picker.$emit('pick', [start, end]);
            }
          }, {
              text: '最近30天',
              onClick(picker) {
              const yesterday = new Date();
              yesterday.setDate(yesterday.getDate() - 30);
              const start = new Date(yesterday);
              start.setHours(0, 0, 0, 0);
              const end = new Date();
              end.setHours(23, 59, 59, 999);
              picker.$emit('pick', [start, end]);
            }
          }, {
          text: '本月',
          onClick(picker) {
            const start = new Date();
            start.setDate(1); // 设置日期为本月第一天
            start.setHours(0, 0, 0, 0);
            const end = new Date();
            end.setMonth(end.getMonth() + 1, 0); // 设置日期为本月最后一天
            end.setHours(23, 59, 59, 999);
            picker.$emit('pick', [start, end]);
          }
          }, {
            text: '本年',
            onClick(picker) {
              const end = new Date();
              const start = new Date(new Date().getFullYear(), 0);
              start.setHours(0, 0, 0, 0);
              end.setHours(23, 59, 59, 999);
              picker.$emit('pick', [start, end]);
            }
          },
        ]
        }

export const statusList = {
  title: '状态',
  custom: true,
  fromTxt: [
    { text: '全部', val: '' },
    { text: '待审核', val: '0' },
    { text: '审核已通过', val: '1' },
    { text: '审核未通过', val: '2' }
  ]
}
